
'===============================================================================
'  Generated From - VbNet_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  **
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'MustInherit' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can Override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  Public Class YourObject
'    Inherits _YourObject
'
'  End Class
'
'===============================================================================

' Generated by MyGeneration Version # (1.1.0.0)

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Collections.Specialized

Imports MyGeneration.dOOdads

Namespace SQL
    Public MustInherit Class _Employees
        Inherits SqlClientEntity

        Public Sub New()
            Me.QuerySource = "Employees"
            Me.MappingName = "Employees"
        End Sub

        '=================================================================
        '  Public Overrides Sub AddNew()
        '=================================================================
        '
        '=================================================================
        Public Overrides Sub AddNew()
            MyBase.AddNew()

        End Sub

        Public Overrides Sub FlushData()
            Me._whereClause = Nothing
            MyBase.FlushData()
        End Sub


        '=================================================================
        '  	Public Function LoadAll() As Boolean
        '=================================================================
        '  Loads all of the records in the database, and sets the currentRow to the first row
        '=================================================================
        Public Function LoadAll() As Boolean

            Dim parameters As ListDictionary = Nothing


            Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_EmployeesLoadAll]", parameters)

        End Function

        '=================================================================
        ' Public Overridable Function LoadByPrimaryKey()  As Boolean
        '=================================================================
        '  Loads a single row of via the primary key
        '=================================================================
        Public Overridable Function LoadByPrimaryKey(ByVal EmployeeID As Integer) As Boolean

            Dim parameters As ListDictionary = New ListDictionary
            parameters.Add(Me.Parameters.EmployeeID, EmployeeID)


            Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_EmployeesLoadByPrimaryKey]", parameters)

        End Function

#Region "Parameters"
        Protected Class Parameters

            Public Shared ReadOnly Property EmployeeID() As SqlParameter
                Get
                    Return New SqlParameter("@EmployeeID", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property LastName() As SqlParameter
                Get
                    Return New SqlParameter("@LastName", SqlDbType.NVarChar, 20)
                End Get
            End Property

            Public Shared ReadOnly Property FirstName() As SqlParameter
                Get
                    Return New SqlParameter("@FirstName", SqlDbType.NVarChar, 10)
                End Get
            End Property

            Public Shared ReadOnly Property Title() As SqlParameter
                Get
                    Return New SqlParameter("@Title", SqlDbType.NVarChar, 30)
                End Get
            End Property

            Public Shared ReadOnly Property TitleOfCourtesy() As SqlParameter
                Get
                    Return New SqlParameter("@TitleOfCourtesy", SqlDbType.NVarChar, 25)
                End Get
            End Property

            Public Shared ReadOnly Property BirthDate() As SqlParameter
                Get
                    Return New SqlParameter("@BirthDate", SqlDbType.DateTime, 0)
                End Get
            End Property

            Public Shared ReadOnly Property HireDate() As SqlParameter
                Get
                    Return New SqlParameter("@HireDate", SqlDbType.DateTime, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Address() As SqlParameter
                Get
                    Return New SqlParameter("@Address", SqlDbType.NVarChar, 60)
                End Get
            End Property

            Public Shared ReadOnly Property City() As SqlParameter
                Get
                    Return New SqlParameter("@City", SqlDbType.NVarChar, 15)
                End Get
            End Property

            Public Shared ReadOnly Property Region() As SqlParameter
                Get
                    Return New SqlParameter("@Region", SqlDbType.NVarChar, 15)
                End Get
            End Property

            Public Shared ReadOnly Property PostalCode() As SqlParameter
                Get
                    Return New SqlParameter("@PostalCode", SqlDbType.NVarChar, 10)
                End Get
            End Property

            Public Shared ReadOnly Property Country() As SqlParameter
                Get
                    Return New SqlParameter("@Country", SqlDbType.NVarChar, 15)
                End Get
            End Property

            Public Shared ReadOnly Property HomePhone() As SqlParameter
                Get
                    Return New SqlParameter("@HomePhone", SqlDbType.NVarChar, 24)
                End Get
            End Property

            Public Shared ReadOnly Property Extension() As SqlParameter
                Get
                    Return New SqlParameter("@Extension", SqlDbType.NVarChar, 4)
                End Get
            End Property

            Public Shared ReadOnly Property Photo() As SqlParameter
                Get
                    Return New SqlParameter("@Photo", SqlDbType.Image, 2147483647)
                End Get
            End Property

            Public Shared ReadOnly Property Notes() As SqlParameter
                Get
                    Return New SqlParameter("@Notes", SqlDbType.NText, 1073741823)
                End Get
            End Property

            Public Shared ReadOnly Property ReportsTo() As SqlParameter
                Get
                    Return New SqlParameter("@ReportsTo", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property PhotoPath() As SqlParameter
                Get
                    Return New SqlParameter("@PhotoPath", SqlDbType.NVarChar, 255)
                End Get
            End Property

        End Class
#End Region

#Region "ColumnNames"
        Public Class ColumnNames

            Public Const EmployeeID As String = "EmployeeID"
            Public Const LastName As String = "LastName"
            Public Const FirstName As String = "FirstName"
            Public Const Title As String = "Title"
            Public Const TitleOfCourtesy As String = "TitleOfCourtesy"
            Public Const BirthDate As String = "BirthDate"
            Public Const HireDate As String = "HireDate"
            Public Const Address As String = "Address"
            Public Const City As String = "City"
            Public Const Region As String = "Region"
            Public Const PostalCode As String = "PostalCode"
            Public Const Country As String = "Country"
            Public Const HomePhone As String = "HomePhone"
            Public Const Extension As String = "Extension"
            Public Const Photo As String = "Photo"
            Public Const Notes As String = "Notes"
            Public Const ReportsTo As String = "ReportsTo"
            Public Const PhotoPath As String = "PhotoPath"

            Public Shared Function ToPropertyName(ByVal columnName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(EmployeeID) = _Employees.PropertyNames.EmployeeID
                    ht(LastName) = _Employees.PropertyNames.LastName
                    ht(FirstName) = _Employees.PropertyNames.FirstName
                    ht(Title) = _Employees.PropertyNames.Title
                    ht(TitleOfCourtesy) = _Employees.PropertyNames.TitleOfCourtesy
                    ht(BirthDate) = _Employees.PropertyNames.BirthDate
                    ht(HireDate) = _Employees.PropertyNames.HireDate
                    ht(Address) = _Employees.PropertyNames.Address
                    ht(City) = _Employees.PropertyNames.City
                    ht(Region) = _Employees.PropertyNames.Region
                    ht(PostalCode) = _Employees.PropertyNames.PostalCode
                    ht(Country) = _Employees.PropertyNames.Country
                    ht(HomePhone) = _Employees.PropertyNames.HomePhone
                    ht(Extension) = _Employees.PropertyNames.Extension
                    ht(Photo) = _Employees.PropertyNames.Photo
                    ht(Notes) = _Employees.PropertyNames.Notes
                    ht(ReportsTo) = _Employees.PropertyNames.ReportsTo
                    ht(PhotoPath) = _Employees.PropertyNames.PhotoPath

                End If

                Return CType(ht(columnName), String)

            End Function

            Private Shared ht As Hashtable = Nothing
        End Class
#End Region

#Region "PropertyNames"
        Public Class PropertyNames

            Public Const EmployeeID As String = "EmployeeID"
            Public Const LastName As String = "LastName"
            Public Const FirstName As String = "FirstName"
            Public Const Title As String = "Title"
            Public Const TitleOfCourtesy As String = "TitleOfCourtesy"
            Public Const BirthDate As String = "BirthDate"
            Public Const HireDate As String = "HireDate"
            Public Const Address As String = "Address"
            Public Const City As String = "City"
            Public Const Region As String = "Region"
            Public Const PostalCode As String = "PostalCode"
            Public Const Country As String = "Country"
            Public Const HomePhone As String = "HomePhone"
            Public Const Extension As String = "Extension"
            Public Const Photo As String = "Photo"
            Public Const Notes As String = "Notes"
            Public Const ReportsTo As String = "ReportsTo"
            Public Const PhotoPath As String = "PhotoPath"

            Public Shared Function ToColumnName(ByVal propertyName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(EmployeeID) = _Employees.ColumnNames.EmployeeID
                    ht(LastName) = _Employees.ColumnNames.LastName
                    ht(FirstName) = _Employees.ColumnNames.FirstName
                    ht(Title) = _Employees.ColumnNames.Title
                    ht(TitleOfCourtesy) = _Employees.ColumnNames.TitleOfCourtesy
                    ht(BirthDate) = _Employees.ColumnNames.BirthDate
                    ht(HireDate) = _Employees.ColumnNames.HireDate
                    ht(Address) = _Employees.ColumnNames.Address
                    ht(City) = _Employees.ColumnNames.City
                    ht(Region) = _Employees.ColumnNames.Region
                    ht(PostalCode) = _Employees.ColumnNames.PostalCode
                    ht(Country) = _Employees.ColumnNames.Country
                    ht(HomePhone) = _Employees.ColumnNames.HomePhone
                    ht(Extension) = _Employees.ColumnNames.Extension
                    ht(Photo) = _Employees.ColumnNames.Photo
                    ht(Notes) = _Employees.ColumnNames.Notes
                    ht(ReportsTo) = _Employees.ColumnNames.ReportsTo
                    ht(PhotoPath) = _Employees.ColumnNames.PhotoPath

                End If

                Return CType(ht(propertyName), String)

            End Function

            Private Shared ht As Hashtable = Nothing

        End Class
#End Region

#Region "StringPropertyNames"
        Public Class StringPropertyNames

            Public Const EmployeeID As String = "s_EmployeeID"
            Public Const LastName As String = "s_LastName"
            Public Const FirstName As String = "s_FirstName"
            Public Const Title As String = "s_Title"
            Public Const TitleOfCourtesy As String = "s_TitleOfCourtesy"
            Public Const BirthDate As String = "s_BirthDate"
            Public Const HireDate As String = "s_HireDate"
            Public Const Address As String = "s_Address"
            Public Const City As String = "s_City"
            Public Const Region As String = "s_Region"
            Public Const PostalCode As String = "s_PostalCode"
            Public Const Country As String = "s_Country"
            Public Const HomePhone As String = "s_HomePhone"
            Public Const Extension As String = "s_Extension"
            Public Const Photo As String = "s_Photo"
            Public Const Notes As String = "s_Notes"
            Public Const ReportsTo As String = "s_ReportsTo"
            Public Const PhotoPath As String = "s_PhotoPath"

        End Class
#End Region

#Region "Properties"
        Public Overridable Property EmployeeID() As Integer
            Get
                Return MyBase.GetInteger(ColumnNames.EmployeeID)
            End Get
            Set(ByVal Value As Integer)
                MyBase.SetInteger(ColumnNames.EmployeeID, Value)
            End Set
        End Property

        Public Overridable Property LastName() As String
            Get
                Return MyBase.GetString(ColumnNames.LastName)
            End Get
            Set(ByVal Value As String)
                MyBase.SetString(ColumnNames.LastName, Value)
            End Set
        End Property

        Public Overridable Property FirstName() As String
            Get
                Return MyBase.GetString(ColumnNames.FirstName)
            End Get
            Set(ByVal Value As String)
                MyBase.SetString(ColumnNames.FirstName, Value)
            End Set
        End Property

        Public Overridable Property Title() As String
            Get
                Return MyBase.GetString(ColumnNames.Title)
            End Get
            Set(ByVal Value As String)
                MyBase.SetString(ColumnNames.Title, Value)
            End Set
        End Property

        Public Overridable Property TitleOfCourtesy() As String
            Get
                Return MyBase.GetString(ColumnNames.TitleOfCourtesy)
            End Get
            Set(ByVal Value As String)
                MyBase.SetString(ColumnNames.TitleOfCourtesy, Value)
            End Set
        End Property

        Public Overridable Property BirthDate() As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.BirthDate)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.BirthDate, Value)
            End Set
        End Property

        Public Overridable Property HireDate() As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.HireDate)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.HireDate, Value)
            End Set
        End Property

        Public Overridable Property Address() As String
            Get
                Return MyBase.GetString(ColumnNames.Address)
            End Get
            Set(ByVal Value As String)
                MyBase.SetString(ColumnNames.Address, Value)
            End Set
        End Property

        Public Overridable Property City() As String
            Get
                Return MyBase.GetString(ColumnNames.City)
            End Get
            Set(ByVal Value As String)
                MyBase.SetString(ColumnNames.City, Value)
            End Set
        End Property

        Public Overridable Property Region() As String
            Get
                Return MyBase.GetString(ColumnNames.Region)
            End Get
            Set(ByVal Value As String)
                MyBase.SetString(ColumnNames.Region, Value)
            End Set
        End Property

        Public Overridable Property PostalCode() As String
            Get
                Return MyBase.GetString(ColumnNames.PostalCode)
            End Get
            Set(ByVal Value As String)
                MyBase.SetString(ColumnNames.PostalCode, Value)
            End Set
        End Property

        Public Overridable Property Country() As String
            Get
                Return MyBase.GetString(ColumnNames.Country)
            End Get
            Set(ByVal Value As String)
                MyBase.SetString(ColumnNames.Country, Value)
            End Set
        End Property

        Public Overridable Property HomePhone() As String
            Get
                Return MyBase.GetString(ColumnNames.HomePhone)
            End Get
            Set(ByVal Value As String)
                MyBase.SetString(ColumnNames.HomePhone, Value)
            End Set
        End Property

        Public Overridable Property Extension() As String
            Get
                Return MyBase.GetString(ColumnNames.Extension)
            End Get
            Set(ByVal Value As String)
                MyBase.SetString(ColumnNames.Extension, Value)
            End Set
        End Property

        Public Overridable Property Photo() As Byte()
            Get
                Return MyBase.GetByteArray(ColumnNames.Photo)
            End Get
            Set(ByVal Value As Byte())
                MyBase.SetByteArray(ColumnNames.Photo, Value)
            End Set
        End Property

        Public Overridable Property Notes() As String
            Get
                Return MyBase.GetString(ColumnNames.Notes)
            End Get
            Set(ByVal Value As String)
                MyBase.SetString(ColumnNames.Notes, Value)
            End Set
        End Property

        Public Overridable Property ReportsTo() As Integer
            Get
                Return MyBase.GetInteger(ColumnNames.ReportsTo)
            End Get
            Set(ByVal Value As Integer)
                MyBase.SetInteger(ColumnNames.ReportsTo, Value)
            End Set
        End Property

        Public Overridable Property PhotoPath() As String
            Get
                Return MyBase.GetString(ColumnNames.PhotoPath)
            End Get
            Set(ByVal Value As String)
                MyBase.SetString(ColumnNames.PhotoPath, Value)
            End Set
        End Property


#End Region

#Region "String Properties"

        Public Overridable Property s_EmployeeID() As String
            Get
                If Me.IsColumnNull(ColumnNames.EmployeeID) Then
                    Return String.Empty
                Else
                    Return MyBase.GetIntegerAsString(ColumnNames.EmployeeID)
                End If
            End Get
            Set(ByVal Value As String)
                If String.Empty = Value Then
                    Me.SetColumnNull(ColumnNames.EmployeeID)
                Else
                    Me.EmployeeID = MyBase.SetIntegerAsString(ColumnNames.EmployeeID, Value)
                End If
            End Set
        End Property

        Public Overridable Property s_LastName() As String
            Get
                If Me.IsColumnNull(ColumnNames.LastName) Then
                    Return String.Empty
                Else
                    Return MyBase.GetStringAsString(ColumnNames.LastName)
                End If
            End Get
            Set(ByVal Value As String)
                If String.Empty = Value Then
                    Me.SetColumnNull(ColumnNames.LastName)
                Else
                    Me.LastName = MyBase.SetStringAsString(ColumnNames.LastName, Value)
                End If
            End Set
        End Property

        Public Overridable Property s_FirstName() As String
            Get
                If Me.IsColumnNull(ColumnNames.FirstName) Then
                    Return String.Empty
                Else
                    Return MyBase.GetStringAsString(ColumnNames.FirstName)
                End If
            End Get
            Set(ByVal Value As String)
                If String.Empty = Value Then
                    Me.SetColumnNull(ColumnNames.FirstName)
                Else
                    Me.FirstName = MyBase.SetStringAsString(ColumnNames.FirstName, Value)
                End If
            End Set
        End Property

        Public Overridable Property s_Title() As String
            Get
                If Me.IsColumnNull(ColumnNames.Title) Then
                    Return String.Empty
                Else
                    Return MyBase.GetStringAsString(ColumnNames.Title)
                End If
            End Get
            Set(ByVal Value As String)
                If String.Empty = Value Then
                    Me.SetColumnNull(ColumnNames.Title)
                Else
                    Me.Title = MyBase.SetStringAsString(ColumnNames.Title, Value)
                End If
            End Set
        End Property

        Public Overridable Property s_TitleOfCourtesy() As String
            Get
                If Me.IsColumnNull(ColumnNames.TitleOfCourtesy) Then
                    Return String.Empty
                Else
                    Return MyBase.GetStringAsString(ColumnNames.TitleOfCourtesy)
                End If
            End Get
            Set(ByVal Value As String)
                If String.Empty = Value Then
                    Me.SetColumnNull(ColumnNames.TitleOfCourtesy)
                Else
                    Me.TitleOfCourtesy = MyBase.SetStringAsString(ColumnNames.TitleOfCourtesy, Value)
                End If
            End Set
        End Property

        Public Overridable Property s_BirthDate() As String
            Get
                If Me.IsColumnNull(ColumnNames.BirthDate) Then
                    Return String.Empty
                Else
                    Return MyBase.GetDateTimeAsString(ColumnNames.BirthDate)
                End If
            End Get
            Set(ByVal Value As String)
                If String.Empty = Value Then
                    Me.SetColumnNull(ColumnNames.BirthDate)
                Else
                    Me.BirthDate = MyBase.SetDateTimeAsString(ColumnNames.BirthDate, Value)
                End If
            End Set
        End Property

        Public Overridable Property s_HireDate() As String
            Get
                If Me.IsColumnNull(ColumnNames.HireDate) Then
                    Return String.Empty
                Else
                    Return MyBase.GetDateTimeAsString(ColumnNames.HireDate)
                End If
            End Get
            Set(ByVal Value As String)
                If String.Empty = Value Then
                    Me.SetColumnNull(ColumnNames.HireDate)
                Else
                    Me.HireDate = MyBase.SetDateTimeAsString(ColumnNames.HireDate, Value)
                End If
            End Set
        End Property

        Public Overridable Property s_Address() As String
            Get
                If Me.IsColumnNull(ColumnNames.Address) Then
                    Return String.Empty
                Else
                    Return MyBase.GetStringAsString(ColumnNames.Address)
                End If
            End Get
            Set(ByVal Value As String)
                If String.Empty = Value Then
                    Me.SetColumnNull(ColumnNames.Address)
                Else
                    Me.Address = MyBase.SetStringAsString(ColumnNames.Address, Value)
                End If
            End Set
        End Property

        Public Overridable Property s_City() As String
            Get
                If Me.IsColumnNull(ColumnNames.City) Then
                    Return String.Empty
                Else
                    Return MyBase.GetStringAsString(ColumnNames.City)
                End If
            End Get
            Set(ByVal Value As String)
                If String.Empty = Value Then
                    Me.SetColumnNull(ColumnNames.City)
                Else
                    Me.City = MyBase.SetStringAsString(ColumnNames.City, Value)
                End If
            End Set
        End Property

        Public Overridable Property s_Region() As String
            Get
                If Me.IsColumnNull(ColumnNames.Region) Then
                    Return String.Empty
                Else
                    Return MyBase.GetStringAsString(ColumnNames.Region)
                End If
            End Get
            Set(ByVal Value As String)
                If String.Empty = Value Then
                    Me.SetColumnNull(ColumnNames.Region)
                Else
                    Me.Region = MyBase.SetStringAsString(ColumnNames.Region, Value)
                End If
            End Set
        End Property

        Public Overridable Property s_PostalCode() As String
            Get
                If Me.IsColumnNull(ColumnNames.PostalCode) Then
                    Return String.Empty
                Else
                    Return MyBase.GetStringAsString(ColumnNames.PostalCode)
                End If
            End Get
            Set(ByVal Value As String)
                If String.Empty = Value Then
                    Me.SetColumnNull(ColumnNames.PostalCode)
                Else
                    Me.PostalCode = MyBase.SetStringAsString(ColumnNames.PostalCode, Value)
                End If
            End Set
        End Property

        Public Overridable Property s_Country() As String
            Get
                If Me.IsColumnNull(ColumnNames.Country) Then
                    Return String.Empty
                Else
                    Return MyBase.GetStringAsString(ColumnNames.Country)
                End If
            End Get
            Set(ByVal Value As String)
                If String.Empty = Value Then
                    Me.SetColumnNull(ColumnNames.Country)
                Else
                    Me.Country = MyBase.SetStringAsString(ColumnNames.Country, Value)
                End If
            End Set
        End Property

        Public Overridable Property s_HomePhone() As String
            Get
                If Me.IsColumnNull(ColumnNames.HomePhone) Then
                    Return String.Empty
                Else
                    Return MyBase.GetStringAsString(ColumnNames.HomePhone)
                End If
            End Get
            Set(ByVal Value As String)
                If String.Empty = Value Then
                    Me.SetColumnNull(ColumnNames.HomePhone)
                Else
                    Me.HomePhone = MyBase.SetStringAsString(ColumnNames.HomePhone, Value)
                End If
            End Set
        End Property

        Public Overridable Property s_Extension() As String
            Get
                If Me.IsColumnNull(ColumnNames.Extension) Then
                    Return String.Empty
                Else
                    Return MyBase.GetStringAsString(ColumnNames.Extension)
                End If
            End Get
            Set(ByVal Value As String)
                If String.Empty = Value Then
                    Me.SetColumnNull(ColumnNames.Extension)
                Else
                    Me.Extension = MyBase.SetStringAsString(ColumnNames.Extension, Value)
                End If
            End Set
        End Property

        Public Overridable Property s_Notes() As String
            Get
                If Me.IsColumnNull(ColumnNames.Notes) Then
                    Return String.Empty
                Else
                    Return MyBase.GetStringAsString(ColumnNames.Notes)
                End If
            End Get
            Set(ByVal Value As String)
                If String.Empty = Value Then
                    Me.SetColumnNull(ColumnNames.Notes)
                Else
                    Me.Notes = MyBase.SetStringAsString(ColumnNames.Notes, Value)
                End If
            End Set
        End Property

        Public Overridable Property s_ReportsTo() As String
            Get
                If Me.IsColumnNull(ColumnNames.ReportsTo) Then
                    Return String.Empty
                Else
                    Return MyBase.GetIntegerAsString(ColumnNames.ReportsTo)
                End If
            End Get
            Set(ByVal Value As String)
                If String.Empty = Value Then
                    Me.SetColumnNull(ColumnNames.ReportsTo)
                Else
                    Me.ReportsTo = MyBase.SetIntegerAsString(ColumnNames.ReportsTo, Value)
                End If
            End Set
        End Property

        Public Overridable Property s_PhotoPath() As String
            Get
                If Me.IsColumnNull(ColumnNames.PhotoPath) Then
                    Return String.Empty
                Else
                    Return MyBase.GetStringAsString(ColumnNames.PhotoPath)
                End If
            End Get
            Set(ByVal Value As String)
                If String.Empty = Value Then
                    Me.SetColumnNull(ColumnNames.PhotoPath)
                Else
                    Me.PhotoPath = MyBase.SetStringAsString(ColumnNames.PhotoPath, Value)
                End If
            End Set
        End Property


#End Region

#Region "Where Clause"
        Public Class WhereClause

            Public Sub New(ByVal entity As BusinessEntity)
                Me._entity = entity
            End Sub

            Public ReadOnly Property TearOff() As TearOffWhereParameter
                Get
                    If _tearOff Is Nothing Then
                        _tearOff = New TearOffWhereParameter(Me)
                    End If

                    Return _tearOff
                End Get
            End Property

#Region "TearOff's"
            Public Class TearOffWhereParameter

                Public Sub New(ByVal clause As WhereClause)
                    Me._clause = clause
                End Sub


                Public ReadOnly Property EmployeeID() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.EmployeeID, Parameters.EmployeeID)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property LastName() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.LastName, Parameters.LastName)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property FirstName() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.FirstName, Parameters.FirstName)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Title() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Title, Parameters.Title)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property TitleOfCourtesy() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.TitleOfCourtesy, Parameters.TitleOfCourtesy)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property BirthDate() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.BirthDate, Parameters.BirthDate)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property HireDate() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.HireDate, Parameters.HireDate)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Address() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Address, Parameters.Address)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property City() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.City, Parameters.City)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Region() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Region, Parameters.Region)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property PostalCode() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.PostalCode, Parameters.PostalCode)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Country() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Country, Parameters.Country)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property HomePhone() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.HomePhone, Parameters.HomePhone)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Extension() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Extension, Parameters.Extension)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Photo() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Photo, Parameters.Photo)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Notes() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Notes, Parameters.Notes)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property ReportsTo() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.ReportsTo, Parameters.ReportsTo)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property PhotoPath() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.PhotoPath, Parameters.PhotoPath)
                        Me._clause._entity.Query.AddWhereParemeter(where)
                        Return where
                    End Get
                End Property


                Private _clause As WhereClause
            End Class
#End Region

            Public ReadOnly Property EmployeeID() As WhereParameter
                Get
                    If _EmployeeID_W Is Nothing Then
                        _EmployeeID_W = TearOff.EmployeeID
                    End If
                    Return _EmployeeID_W
                End Get
            End Property

            Public ReadOnly Property LastName() As WhereParameter
                Get
                    If _LastName_W Is Nothing Then
                        _LastName_W = TearOff.LastName
                    End If
                    Return _LastName_W
                End Get
            End Property

            Public ReadOnly Property FirstName() As WhereParameter
                Get
                    If _FirstName_W Is Nothing Then
                        _FirstName_W = TearOff.FirstName
                    End If
                    Return _FirstName_W
                End Get
            End Property

            Public ReadOnly Property Title() As WhereParameter
                Get
                    If _Title_W Is Nothing Then
                        _Title_W = TearOff.Title
                    End If
                    Return _Title_W
                End Get
            End Property

            Public ReadOnly Property TitleOfCourtesy() As WhereParameter
                Get
                    If _TitleOfCourtesy_W Is Nothing Then
                        _TitleOfCourtesy_W = TearOff.TitleOfCourtesy
                    End If
                    Return _TitleOfCourtesy_W
                End Get
            End Property

            Public ReadOnly Property BirthDate() As WhereParameter
                Get
                    If _BirthDate_W Is Nothing Then
                        _BirthDate_W = TearOff.BirthDate
                    End If
                    Return _BirthDate_W
                End Get
            End Property

            Public ReadOnly Property HireDate() As WhereParameter
                Get
                    If _HireDate_W Is Nothing Then
                        _HireDate_W = TearOff.HireDate
                    End If
                    Return _HireDate_W
                End Get
            End Property

            Public ReadOnly Property Address() As WhereParameter
                Get
                    If _Address_W Is Nothing Then
                        _Address_W = TearOff.Address
                    End If
                    Return _Address_W
                End Get
            End Property

            Public ReadOnly Property City() As WhereParameter
                Get
                    If _City_W Is Nothing Then
                        _City_W = TearOff.City
                    End If
                    Return _City_W
                End Get
            End Property

            Public ReadOnly Property Region() As WhereParameter
                Get
                    If _Region_W Is Nothing Then
                        _Region_W = TearOff.Region
                    End If
                    Return _Region_W
                End Get
            End Property

            Public ReadOnly Property PostalCode() As WhereParameter
                Get
                    If _PostalCode_W Is Nothing Then
                        _PostalCode_W = TearOff.PostalCode
                    End If
                    Return _PostalCode_W
                End Get
            End Property

            Public ReadOnly Property Country() As WhereParameter
                Get
                    If _Country_W Is Nothing Then
                        _Country_W = TearOff.Country
                    End If
                    Return _Country_W
                End Get
            End Property

            Public ReadOnly Property HomePhone() As WhereParameter
                Get
                    If _HomePhone_W Is Nothing Then
                        _HomePhone_W = TearOff.HomePhone
                    End If
                    Return _HomePhone_W
                End Get
            End Property

            Public ReadOnly Property Extension() As WhereParameter
                Get
                    If _Extension_W Is Nothing Then
                        _Extension_W = TearOff.Extension
                    End If
                    Return _Extension_W
                End Get
            End Property

            Public ReadOnly Property Photo() As WhereParameter
                Get
                    If _Photo_W Is Nothing Then
                        _Photo_W = TearOff.Photo
                    End If
                    Return _Photo_W
                End Get
            End Property

            Public ReadOnly Property Notes() As WhereParameter
                Get
                    If _Notes_W Is Nothing Then
                        _Notes_W = TearOff.Notes
                    End If
                    Return _Notes_W
                End Get
            End Property

            Public ReadOnly Property ReportsTo() As WhereParameter
                Get
                    If _ReportsTo_W Is Nothing Then
                        _ReportsTo_W = TearOff.ReportsTo
                    End If
                    Return _ReportsTo_W
                End Get
            End Property

            Public ReadOnly Property PhotoPath() As WhereParameter
                Get
                    If _PhotoPath_W Is Nothing Then
                        _PhotoPath_W = TearOff.PhotoPath
                    End If
                    Return _PhotoPath_W
                End Get
            End Property

            Private _EmployeeID_W As WhereParameter = Nothing
            Private _LastName_W As WhereParameter = Nothing
            Private _FirstName_W As WhereParameter = Nothing
            Private _Title_W As WhereParameter = Nothing
            Private _TitleOfCourtesy_W As WhereParameter = Nothing
            Private _BirthDate_W As WhereParameter = Nothing
            Private _HireDate_W As WhereParameter = Nothing
            Private _Address_W As WhereParameter = Nothing
            Private _City_W As WhereParameter = Nothing
            Private _Region_W As WhereParameter = Nothing
            Private _PostalCode_W As WhereParameter = Nothing
            Private _Country_W As WhereParameter = Nothing
            Private _HomePhone_W As WhereParameter = Nothing
            Private _Extension_W As WhereParameter = Nothing
            Private _Photo_W As WhereParameter = Nothing
            Private _Notes_W As WhereParameter = Nothing
            Private _ReportsTo_W As WhereParameter = Nothing
            Private _PhotoPath_W As WhereParameter = Nothing

            Public Sub WhereClauseReset()

                _EmployeeID_W = Nothing
                _LastName_W = Nothing
                _FirstName_W = Nothing
                _Title_W = Nothing
                _TitleOfCourtesy_W = Nothing
                _BirthDate_W = Nothing
                _HireDate_W = Nothing
                _Address_W = Nothing
                _City_W = Nothing
                _Region_W = Nothing
                _PostalCode_W = Nothing
                _Country_W = Nothing
                _HomePhone_W = Nothing
                _Extension_W = Nothing
                _Photo_W = Nothing
                _Notes_W = Nothing
                _ReportsTo_W = Nothing
                _PhotoPath_W = Nothing
                Me._entity.Query.FlushWhereParameters()

            End Sub

            Private _entity As BusinessEntity
            Private _tearOff As TearOffWhereParameter
        End Class

        Public ReadOnly Property Where() As WhereClause
            Get
                If _whereClause Is Nothing Then
                    _whereClause = New WhereClause(Me)
                End If

                Return _whereClause
            End Get
        End Property

        Private _whereClause As WhereClause = Nothing
#End Region

        Protected Overrides Function GetInsertCommand() As IDbCommand

            Dim cmd As SqlCommand = New SqlCommand
            cmd.CommandType = CommandType.StoredProcedure
            cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_EmployeesInsert]"

            CreateParameters(cmd)

            Dim p As SqlParameter
            p = cmd.Parameters(Parameters.EmployeeID.ParameterName)
            p.Direction = ParameterDirection.Output

            Return cmd

        End Function

        Protected Overrides Function GetUpdateCommand() As IDbCommand

            Dim cmd As SqlCommand = New SqlCommand
            cmd.CommandType = CommandType.StoredProcedure
            cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_EmployeesUpdate]"

            CreateParameters(cmd)

            Return cmd

        End Function

        Protected Overrides Function GetDeleteCommand() As IDbCommand

            Dim cmd As SqlCommand = New SqlCommand
            cmd.CommandType = CommandType.StoredProcedure
            cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_EmployeesDelete]"

            Dim p As SqlParameter
            p = cmd.Parameters.Add(Parameters.EmployeeID)
            p.SourceColumn = ColumnNames.EmployeeID
            p.SourceVersion = DataRowVersion.Current


            Return cmd

        End Function

        Private Sub CreateParameters(ByVal cmd As SqlCommand)

            Dim p As SqlParameter
            p = cmd.Parameters.Add(Parameters.EmployeeID)
            p.SourceColumn = ColumnNames.EmployeeID
            p.SourceVersion = DataRowVersion.Current

            p = cmd.Parameters.Add(Parameters.LastName)
            p.SourceColumn = ColumnNames.LastName
            p.SourceVersion = DataRowVersion.Current

            p = cmd.Parameters.Add(Parameters.FirstName)
            p.SourceColumn = ColumnNames.FirstName
            p.SourceVersion = DataRowVersion.Current

            p = cmd.Parameters.Add(Parameters.Title)
            p.SourceColumn = ColumnNames.Title
            p.SourceVersion = DataRowVersion.Current

            p = cmd.Parameters.Add(Parameters.TitleOfCourtesy)
            p.SourceColumn = ColumnNames.TitleOfCourtesy
            p.SourceVersion = DataRowVersion.Current

            p = cmd.Parameters.Add(Parameters.BirthDate)
            p.SourceColumn = ColumnNames.BirthDate
            p.SourceVersion = DataRowVersion.Current

            p = cmd.Parameters.Add(Parameters.HireDate)
            p.SourceColumn = ColumnNames.HireDate
            p.SourceVersion = DataRowVersion.Current

            p = cmd.Parameters.Add(Parameters.Address)
            p.SourceColumn = ColumnNames.Address
            p.SourceVersion = DataRowVersion.Current

            p = cmd.Parameters.Add(Parameters.City)
            p.SourceColumn = ColumnNames.City
            p.SourceVersion = DataRowVersion.Current

            p = cmd.Parameters.Add(Parameters.Region)
            p.SourceColumn = ColumnNames.Region
            p.SourceVersion = DataRowVersion.Current

            p = cmd.Parameters.Add(Parameters.PostalCode)
            p.SourceColumn = ColumnNames.PostalCode
            p.SourceVersion = DataRowVersion.Current

            p = cmd.Parameters.Add(Parameters.Country)
            p.SourceColumn = ColumnNames.Country
            p.SourceVersion = DataRowVersion.Current

            p = cmd.Parameters.Add(Parameters.HomePhone)
            p.SourceColumn = ColumnNames.HomePhone
            p.SourceVersion = DataRowVersion.Current

            p = cmd.Parameters.Add(Parameters.Extension)
            p.SourceColumn = ColumnNames.Extension
            p.SourceVersion = DataRowVersion.Current

            p = cmd.Parameters.Add(Parameters.Photo)
            p.SourceColumn = ColumnNames.Photo
            p.SourceVersion = DataRowVersion.Current

            p = cmd.Parameters.Add(Parameters.Notes)
            p.SourceColumn = ColumnNames.Notes
            p.SourceVersion = DataRowVersion.Current

            p = cmd.Parameters.Add(Parameters.ReportsTo)
            p.SourceColumn = ColumnNames.ReportsTo
            p.SourceVersion = DataRowVersion.Current

            p = cmd.Parameters.Add(Parameters.PhotoPath)
            p.SourceColumn = ColumnNames.PhotoPath
            p.SourceVersion = DataRowVersion.Current


        End Sub

    End Class

End Namespace
